package com.shengqi.xinnongren.work.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.WindowManager;

import com.shengqi.xinnongren.R;


public class LoadingDialog extends Dialog {
    public LoadingDialog(@NonNull Context context) {
        super(context);
    }

    public LoadingDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().getAttributes().width = WindowManager.LayoutParams.MATCH_PARENT;
    }

    public static class Builder {
        private Context mContext;


        public Builder(Context context) {
            mContext = context;
        }

        public LoadingDialog build() {
            final LoadingDialog dialog = new LoadingDialog(mContext, R.style.CustomDialog_NoBgDim);
            View layout = View.inflate(mContext, R.layout.dialog_loading, null);
            //将布局添加到 dialog 中
            dialog.setContentView(layout);
            return dialog;
        }

    }
}
